package com.beidasoft.web.model.caseManager;

import com.beidasoft.web.annotation.ESQuery;
import com.beidasoft.web.util.enums.ESOperator;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@Document(indexName = "law_case", replicas = 0)
//@ApiModel(value = "案件对象ES文档类")
public class LawCaseEntity {

    @Id
    @Field(store = true, type = FieldType.Text, index = false)
    //@ApiModelProperty(value = "主键")
    private String id;

    @Field(type = FieldType.Keyword)
    //@ApiModelProperty(value = "来源类型（01：监督；02：执法）")
    private String sourceType;

    @Field(type = FieldType.Keyword)
    //@ApiModelProperty(value = "案件类型（01：简易程序；02：普通程序）")
    private String caseType;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    //@ApiModelProperty(value = "案件名称")
    private String caseName;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    //@ApiModelProperty(value = "案件编号")
    private String caseCode;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    //@ApiModelProperty(value = "立案文号")
    private String filingCode;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    //@ApiModelProperty(value = "处罚决定书文号")
    private String punishCode;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    //@ApiModelProperty(value = "当事人名称")
    private String litigantName;

    @Field(type = FieldType.Keyword)
    //@ApiModelProperty(value = "当事人类型")
    private String litigantType;

    @Field(type = FieldType.Keyword)
    //@ApiModelProperty(value = "当事人类型名称")
    private String litigantTypeName;

    @Field(type = FieldType.Keyword)
    //@ApiModelProperty(value = "办理机构")
    private String organizationId;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    //@ApiModelProperty(value = "办理机构名称")
    private String organizationName;

    @Field(type = FieldType.Keyword)
    //@ApiModelProperty(value = "办理处室")
    private String departmentId;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    //@ApiModelProperty(value = "办理处室名称")
    private String departmentName;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss", timezone ="GMT+8")
    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "uuuu-MM-dd HH:mm:ss")
    //@ApiModelProperty(value = "案件创建时间")
    private LocalDateTime createTime;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd", timezone ="GMT+8")
    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "uuuu-MM-dd")
    //@ApiModelProperty(value = "案件立案日期")
    private LocalDate filingDate;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd", timezone ="GMT+8")
    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "uuuu-MM-dd")
    //@ApiModelProperty(value = "案件处罚决定书日期")
    private LocalDate punishDate;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd", timezone ="GMT+8")
    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "uuuu-MM-dd")
    //@ApiModelProperty(value = "案件结案日期")
    private LocalDate closedDate;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern ="yyyy-MM-dd HH:mm:ss", timezone ="GMT+8")
    @Field(type = FieldType.Date, format = DateFormat.custom, pattern = "uuuu-MM-dd HH:mm:ss")
    //@ApiModelProperty(value = "更新到ES时间")
    private LocalDateTime updateTime;

    //@ApiModelProperty(value = "立案开始时间", hidden = true)
    @ESQuery(operator = ESOperator.gte, keyword = "filingDate")
    private String filingDateStart;

    //@ApiModelProperty(value = "立案结束时间", hidden = true)
    @ESQuery(operator = ESOperator.lt, keyword = "filingDate")
    private String filingDateEnd;

    //@ApiModelProperty(value = "处罚决定书开始时间", hidden = true)
    @ESQuery(operator = ESOperator.gte, keyword = "punishDate")
    private String punishDateStart;

    //@ApiModelProperty(value = "处罚决定书结束时间", hidden = true)
    @ESQuery(operator = ESOperator.lt, keyword = "punishDate")
    private String punishDateEnd;

    //@ApiModelProperty(value = "结案开始时间", hidden = true)
    @ESQuery(operator = ESOperator.gte, keyword = "closedDate")
    private String closedDateStart;

    //@ApiModelProperty(value = "结案结束时间", hidden = true)
    @ESQuery(operator = ESOperator.lt, keyword = "closedDate")
    private String closedDateEnd;

}
